#!/bin/bash

# 'ai': 'cs.AI - Artificial Intelligence',
# 'cv': 'cs.CV - Computer Vision and Pattern Recognition',
# 'ro': 'cs.RO - Robotics',
# 'lg': 'cs.LG - Machine Learning',
# 'ma': 'cs.MA - Multiagent Systems',
# 'cl': 'cs.CL - Computation and Language'

prog=collect-arxiv.py

# 定义包含单词的字符串
categorylist="ai lg cl cv ma"
yearlist="2023 2022 2021 2020 2019 2018 2017 2016"
monthlist="12 11 10 09 08 07 06 05 04 03 02 01"
weeklist="5 4 3 2 1"

# 将字符串按空格分割成数组
IFS=' ' read -r -a category_array <<< "$categorylist"
IFS=' ' read -r -a year_array <<< "$yearlist"
IFS=' ' read -r -a month_array <<< "$monthlist"
IFS=' ' read -r -a week_array <<< "$weeklist"

# 循环遍历数组，每次调用 exec 并传递不同的参数
for category in "${category_array[@]}"
do
    for year in "${year_array[@]}"
    do
        for month in "${month_array[@]}"
        do
            for week in "${week_array[@]}"
            do
                echo "--->>> python3 ${prog} -c ${category} -m ${year}${month} -w ${week}"
                python3 ${prog} -c ${category} -m ${year}${month} -w ${week}
               sleep 10 
            done
            sleep 20
        done
        sleep 30 
    done
    sleep 60 
done
